{ "cells": [ { "cell_type": "markdown", "id": "42aabce4-9a6d-4f92-9182-9a91f551e070", "metadata": { "tags": [] }, "source": [ "# Getting Started\n", "\n", "QMzyme is a Python toolkit aimed at facilitating QM-based calculations. To begin with the QM calculation setup, we need to first set the structure file. Currently, QMzyme supports `PDB`, `prmtop`, `RST`, `PQR`, and `DCD` file formats.\n", "\n", "In this example, you will see how you can initialize the QMzyme GenerateModel module in various ways, using the pre-packaged QMzyme data and how these loaded structure files can be used!\n", "\n", "## Classes used in this example\n", "\n", "- [GenerateModel](https://qmzyme.readthedocs.io/en/latest/API/QMzyme.GenerateModel.html)" ] }, { "cell_type": "code", "execution_count": 2, "id": "eb54298b-c61b-4161-8847-6bff92712113", "metadata": {}, "outputs": [], "source": [ "# To start with, we'll import the necesary packages.\n", "import QMzyme\n", "import os" ] }, { "cell_type": "markdown", "id": "f54416ba-4e0d-484f-9a05-9edc5e522192", "metadata": {}, "source": [ "## Initialize Model\n", "After importing QMzyme, we need to initialize `QMzymeModel` by providing a structure file. The GenerateModel class can be initialized in any way that an MDAnalysis Universe can be initialized. Here are some ways to initialize QMzymeModel!" ] }, { "cell_type": "code", "execution_count": 3, "id": "9cf01442-2ef5-4804-8f1d-5bac5ceb838d", "metadata": { "scrolled": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "File: 1oh0.pdb\n", "\n", "Charge information not present. QMzyme will try to guess region charges based on residue names consistent with AMBER naming conventions (i.e., aspartate: ASP --> Charge: -1, aspartic acid: ASH --> Charge: 0.). See QMzyme.data.residue_charges for the full set.\n", "\n", "\tNonconventional Residues Found\n", "\t------------------------------\n", "\tEQU --> Charge: UNK, defaulting to 0\n", "\n", "You can update charge information for nonconventional residues by running \n", "\t>>>QMzyme.data.residue_charges.update({'3LETTER_RESNAME':INTEGER_CHARGE}). \n", "Note your changes will not be stored after you exit your session. It is recommended to only alter the residue_charges dictionary. If you alter the protein_residues dictionary instead that could cause unintended bugs in other modules (TruncationSchemes).\n", "\n", "GenerateModel instance: contains 0 region(s)>\n" ] } ], "source": [ "#1. With a PDB file:\n", "\n", "from QMzyme.data import PDB\n", "print(\"File: \", os.path.basename(PDB))\n", "pdb_model = QMzyme.GenerateModel(PDB)\n", "print(\"GenerateModel instance: \", pdb_model)" ] }, { "cell_type": "code", "execution_count": 4, "id": "88a45a1d-6137-4e6f-ac9d-73d1dea23a38", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Files: 1oh0_equ.prmtop 1oh0_equ.rst7\n", "GenerateModel instance: contains 0 region(s)>\n" ] } ], "source": [ "#2. With a topology file (.prmtop) and a restart file (.rst7) used in an AMBER MM simulation setup.\n", "# The contained structure inclues the water box, so there are many atoms!\n", "\n", "from QMzyme.data import TOP, RST\n", "print(\"Files: \", os.path.basename(TOP), os.path.basename(RST))\n", "top_rst_model = QMzyme.GenerateModel(TOP, RST, format='RESTRT')\n", "print(\"GenerateModel instance: \", top_rst_model)" ] }, { "cell_type": "code", "execution_count": 6, "id": "297ba1ef-987a-4460-9c75-d45d8cad8854", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Files: 1oh0_equ.prod_1.stripped.pqr 1oh0_equ.prod_1.stripped.dcd\n", "GenerateModel instance: contains 0 region(s)>\n" ] } ], "source": [ "#3. With a PQR file, containing charge information, and a trajectory DCD file:\n", "\n", "from QMzyme.data import PQR, DCD\n", "print(\"Files: \", os.path.basename(PQR), os.path.basename(DCD))\n", "pqr_dcd = QMzyme.GenerateModel(PQR, DCD)\n", "print(\"GenerateModel instance: \", pqr_dcd)" ] }, { "cell_type": "markdown", "id": "9175ebc5-ea73-45a2-a01c-64cf050e88fb", "metadata": {}, "source": [ "Congratulations, you have successfully made your first QMzymeModel! The next workflows will walk through how to use QMzyme to generate QM input files for ORCA and Gaussian." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.0" } }, "nbformat": 4, "nbformat_minor": 5 }